import { IFeidaoAiNodejsComponent } from '@feidao/web/interfaces';

////////////////////////////////////////////////////////////////////////////////
// import presentations
import p001 from './p001';
import nodejs from '@feidao/web/atom/nodejs/msg/nodejs';
import render from '@feidao/web/atom/nodejs/render/render';
import storage_get from '@feidao/web/atom/nodejs/storage/get';
import p002 from './p002';
////////////////////////////////////////////////////////////////////////////////


export default async function na001(fd: IFeidaoAiNodejsComponent, ...args: any[]) {
	const data = await storage_get('data', 'page');
	if (data) {
		console.log('获取storage数据');
		render(fd.data.node, data, p001, 'p001');
		render(fd.data.node, data, p002, 'p002');
	} else {
		const data = await nodejs(fd.data.actionid, fd.data.sessionid, fd.data.spaceid, 'db-query', {});
		render(fd.data.node, data, p001, 'p001');

		const data1 = await nodejs(fd.data.actionid, fd.data.sessionid, fd.data.spaceid, 'test/db-query', {});
		render(fd.data.node, data1, p002, 'p002');
	}

}
